package com.gujia.service;

import com.gujia.dao.MessageDao;
import com.gujia.model.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by GuJia on 2017/6/30.
 */
@Service
public class MessageService {

    @Autowired
    private MessageDao messageDao;

    public int addMessage(Message message){
       return messageDao.addMessage(message)>0?message.getId():0;
    }


    public List<Message> getConversationDetail(String conversationId,int offset,int limit){
            return messageDao.getConversationDetail(conversationId,offset,limit);
    }


    public int getConvesationUnreadCount(int userId,String conversationId){
        return messageDao.getConvesationUnreadCount(userId,conversationId);
    }


    public List<Message> getConversationList(int userId,int offset,int limit){
        return messageDao.getConversationList(userId,offset,limit);
    }
}
